﻿using BlockLogic.Impl.Blocks.Checker.Enum;

namespace BlockLogic.Impl.Blocks.Checker.Strategy
{
    public class UniformChecking : CheckingStrategy
    {
        public double Left { get; set; }
        public double Right { get; set; }

        public UniformChecking()
        {
            _type = CheckerType.UNIFORM;
            Left = 0;
            Right = 1;
        }

        public UniformChecking(double left, double right)
        {
            _type = CheckerType.UNIFORM;
            Left = left;
            Right = right;
        }

        protected override double DistributionFunctionValue(double x)
        {
            return x < Left ? 0 : (x > Right ? 1 : (x - Left) / (Right - Left));
        }
    }
}
